home *** CD-ROM | disk | FTP | other *** search
/ Amiga Tools 4 / Amiga Tools 4.iso / tools / internet-tools / connect-line / cl / commands / rexx / cl-pointuser.clrexx next >
Encoding:
Text File  |  1996-02-08  |  12.7 KB  |  440 lines

  1. /*
  2. **  $VER: CL-Pointuser.clrexx 2.0 (07 Feb 1996)
  3. **
  4. **        © 1995-96 Ralf Ramge
  5. **
  6. **  PROGRAMNAME:
  7. **      CL-Pointuser.clrexx
  8. **
  9. **  FUNCTION:
  10. **
  11. **      Connectline © 1986-1995 Oliver Wagner, Mathias Mischler
  12. **      cl_rexx.library © 1995 Mathias Mischler
  13. **
  14. **      Erlaubt, Onlineusern auf ihren Point und auf Maps zuzugreifen.
  15. **
  16. **      Aufruf: CL-PointUser.clrexx <port> [d]
  17. **                  d = NoDelete (User kann Puffer nicht löschen)
  18. **
  19. **  $HISTORY:
  20. **
  21. **   0.1  - Erste lauffähige Version
  22. **   0.2  - Interrupt-Überwachung bzgl. eines Abbruch durch den User
  23. **          Veröffentlichungsreife Beta-Version
  24. **   1.0  - Korrektes Öffnen der cl_rexx.library
  25. **   1.1  - Pointeintrag implementiert, Betastatus
  26. **   1.11 - Bei Pointantrag wird Mapszugriff erteilt, Autoeintrag ge-
  27. **          sperrt
  28. **   1.12 - Bugfix: Copy&Paste-Fehler sorgte dafür, daß anstelle des
  29. **          Pufferbackups der vorgepackte Puffer übertragen wurde
  30. **   1.13 - Optionale Unterstützung von deletepuffer() und maps()
  31. **          Testversion
  32. **   1.14 - Unterstützung von CLGET_PathSpool()
  33. **          $VER: korrigiert <schluck>
  34. **   1.15 - Bug beseitigt: Uploaden des Puffers brachte Fehlermeldung
  35. **   1.16 - Bug beseitigt, unmatched quote
  36. **          Spoolpfad wird auf letztes Zeichen geprüft
  37. **   2.0  - Kein unsicheres Generieren von Mapsnachrichten mehr, statt-
  38. **          dessen Auslegung auf clrexx-Module
  39. **        - kompletter Rewrite
  40. */
  41.  
  42.  
  43. /* Libraries öffnen */
  44.  
  45. if ~show('L','rexxsupport.library') then do
  46.     if ~addlib('rexxsupport.library',0,-30,0) then do
  47.         say 'Inkorrekt installiert!'
  48.         end
  49.     end
  50.  
  51. if ~show('L','cl_rexx.library') then do
  52.     if ~addlib('cl_rexx.library',0,-30,0) then do
  53.         say 'Inkorrekt installiert!'
  54.         end
  55.     end
  56.  
  57. port=word(arg(1),1)
  58. delflag=word(arg(1),2)
  59. if upper(delflag)='D' then delflag='0'
  60.  
  61. address command
  62.  
  63. start:
  64.  
  65. skip=false
  66. new=false
  67. end=false
  68. prefix=''
  69. redirection='>NIL:'
  70. mapsmod='CONNECTLINE:Rexx/Modules/maps.clrexxmod'
  71. stdiomod='CONNECTLINE:Rexx/Modules/stdio.clrexxmod'
  72.  
  73. if ~CLONL_ClearScreen() then exit
  74. user=CLGET_PortUsername(port)
  75. terminal=CLGET_PortTerminal(port)
  76. system=CLGET_OwnSystemAddress()
  77. IF CLIS_UserPoint(user) then do
  78.     point=CLGET_UserPointname(user)
  79.     netz=CLGET_SystemNet(point)
  80.     end
  81. else do
  82.     new=true
  83.     netz='JANUS'
  84.     end
  85.  
  86.  
  87. select
  88.     when netz='JANUS' then systempfad=CLGET_PathJANUS()
  89.     when netz='ZERBERUS' then systempfad=CLGET_PathZERBERUS()
  90.     otherwise skip=true
  91.     end
  92.  
  93. opfad=systempfad
  94. systempfad=systempfad||point'/'
  95. spoolpfad=CLGET_PathSpool()
  96. if right(spoolpfad,1)~='/' then spoolpfad=spoolpfad'/'
  97. menu1:
  98. if exists(systempfad||point||'.PRE') then suffix='.PRE'
  99. else suffix='.MBX'
  100. call CLONL_BlueMode()
  101. say 'CL-Pointuser                                                                  '
  102. call CLONL_Normal()
  103. if skip=false then call readsizes
  104. call CLONL_GotoXY(1,10)
  105. if (skip=false)&(new=true) then taste=CLONL_ShortMenuVertical('Pointantrag stellen','Ende')
  106. if (skip=false)&(new=false)&(delflag~='0') then taste=CLONL_ShortMenuVertical('1 Download des Puffers','2 Upload des Puffers (ungepackt)','3 Backup downloaden','4 Mapsnachricht','E Ende')
  107. if (skip=false)&(new=false)&(delflag='0') then taste=CLONL_ShortMenuVertical('1 Download des Puffers','2 Upload des Puffers (ungepackt)','3 Backup downloaden','4 Mapsnachricht','5 Puffer löschen','E Ende')
  108. call key
  109. ende:
  110. exit
  111.  
  112. key:
  113. select
  114.     when taste='-1' then call ende
  115.     when (taste='1')&(skip=false) then call download
  116.     when (taste='2')&(skip=false) then call upload
  117.     when (taste='3')&(skip=false) then call backupdl
  118.     when (taste='5')&(skip=false)&(delflag='0') then call deletepuffer
  119.     when (taste='P')&(new=true) then do
  120.         call newpoint
  121.         call start
  122.         exit
  123.         end
  124.     when (taste='4')&(skip=false) then call maps
  125.     when taste='E' then return
  126.     otherwise nop
  127.     end
  128. call CLONL_ClearScreen()
  129. call menu1
  130.  
  131. readsizes:
  132.  
  133. packed=word(statef(systempfad||point||'.PRE'),2)
  134. unpacked=word(statef(systempfad||point||'.MBX'),2)
  135. unpprivate=word(statef(systempfad||point||'.MBP'),2)
  136. backup=word(statef(systempfad||point||'.Outgoing-Bak'),2)
  137. if packed='' then packed='0'
  138. if unpacked='' then unpacked='0'
  139. if unpprivate='' then unpprivate='0'
  140. if backup='' then backup='0'
  141. call CLONL_GotoXY(1,3)
  142. say '------------------------------------------------------------------------------'
  143. say 'bereits gepackter Puffer: 'packed' Bytes'
  144. say 'ungepackte Nachrichten  : 'unpacked' Bytes'
  145. say 'ungepackte Mail         : 'unpprivate' Bytes'
  146. say 'Pufferbackup            : 'backup' Bytes'
  147. say '------------------------------------------------------------------------------'
  148. return
  149.  
  150. download:
  151.  
  152. if (packed+unpacked+unpprivate=0) then return
  153. say 'Packe Puffer ...'
  154. if CLGET_SystemPackerOut(point)~='' then address command 'connectline:c/batch >NIL: '||point
  155. if (CLONL_Transfer(systempfad||point||suffix)) then do
  156.     call delete(systempfad||point||'.Outgoing-Bak')
  157.     if CLGET_SystemPackerOut(point)~='' then call rename(systempfad||point||suffix,systempfad||point||.'Outgoing-Bak')
  158.     end
  159. call CLONL_ClearScreen()
  160. call menu1
  161. return
  162.  
  163. backupdl:
  164.  
  165. if backup=0 then return
  166. call CLONL_Transfer(systempfad||point||'.Outgoing-Bak')
  167. return
  168.  
  169. upload:
  170.  
  171. files=CLONL_Receive(port)
  172. if files~='' then do
  173.     do x=1 to words(files)
  174.         rename(word(files,x),spoolpfad||point||'.'compress(time(),':'))
  175.         end
  176.     end
  177. address command 'run >NIL: CONNECTLINE:Modules/CLMSortin'
  178. say ''
  179. say 'Die empfangenen Files werden einsortiert.'
  180. call CLONL_Wait
  181. call CLONL_GotoXY(1,17)
  182. call CLONL_DeleteEOL()
  183. call CLONL_ClearScreen()
  184. call menu1
  185.  
  186. key2:
  187.  
  188. select
  189.     when taste='-1' then call ende
  190.     when taste='1' then do
  191.                     betreff='ADD'
  192.                     action=''
  193.                     call bestellen
  194.                     call maps
  195.                     end
  196.     when taste='2' then do
  197.                     betreff='DEL'
  198.                     action=''
  199.                     call bestellen
  200.                     call maps
  201.                     end
  202.     when taste='3' then do
  203.                     betreff='LIST'
  204.                     prefix='run >NIL: '
  205.                     redirection='>NIL: '
  206.                     action='Die Brettliste wurde angefordert.'
  207.                     'setenv mapsmod -1'
  208.                     call mapscommand
  209.                     prefix=''
  210.                     redirection=''
  211.                     end
  212.     when taste='4' then do
  213.                     betreff='INDEX'
  214.                     prefix='run >NIL: '
  215.                     redirection='>NIL: '
  216.                     action='Die Indizes wurden angefordert.'
  217.                     prefix=''
  218.                     'setenv mapsmod -1'
  219.                     call bestellen
  220.                     call maps
  221.                     end
  222.     when taste='5' then do
  223.                     betreff='HOLDON'
  224.                     prefix='run >NIL: '
  225.                     redirection='>NIL: '
  226.                     action='Die Bretter wurden temporär abbestellt.'
  227.                     prefix=''
  228.                     'setenv mapsmod -1'
  229.                     call mapscommand
  230.                     call maps
  231.                     end
  232.     when taste='6' then do
  233.                     betreff='HOLDOFF'
  234.                     prefix=''
  235.                     redirection=''
  236.                     action='Die Bretter wurden wieder bestellt.'
  237.                     prefix=''
  238.                     call mapscommand
  239.                     call maps
  240.                     end
  241.     when taste='E' then do
  242.         end=true
  243.         return
  244.         end
  245.     otherwise nop
  246.     end
  247. call menu2
  248.  
  249. maps:
  250.  
  251. call CLONL_ClearScreen()
  252. call CLONL_BlueMode()
  253. say 'CL-Pointuser                                                                  '
  254. call CLONL_Normal()
  255. say ''
  256.  
  257. menu2:
  258.  
  259. taste=CLONL_ShortMenuVertical('1 Bretter bestellen','2 Bretter abbestellen','3 Brettliste anfordern','4 Index anfordern','5 Bretter auf Hold','6 Hold deaktivieren','E Ende')
  260. call key2
  261. if end=true then do
  262.     call CLONL_ClearScreen()
  263.     call menu1
  264.     end
  265. return
  266.  
  267. bestellen:
  268.  
  269. filename='T:clpucommand.'point||port
  270. 'CONNECTLINE:Modules/CLEditor 'filename
  271. prefix||' rx 'redirection' 'mapsmod' 'betreff' 'point' 'filename
  272. 'delete >NIL: 'filename
  273. 'run >NIL: CONNECTLINE:Modules/CL-CLMSortin'
  274. say action
  275. 'rx 'stdiomod' CURSORON'
  276. call CLONL_Wait
  277. return
  278.  
  279. mapscommand:
  280. 'rx 'stdiomod' CURSOROFF'
  281. prefix||'rx 'mapsmod' 'betreff','point
  282. say ''
  283. say action
  284. 'rx 'stdiomod' CURSORON'
  285. call CLONL_Wait()
  286. call CLONL_GotoXY(1,11)
  287. call CLONL_DeleteEOL()
  288. call CLONL_GotoXY(1,12)
  289. call CLONL_DeleteEOL()
  290. call CLONL_GotoXY(1,10)
  291. call CLONL_DeleteEOL()
  292. call CLONL_GotoXY(1,3)
  293. return
  294.  
  295. deletepuffer:
  296.  
  297. call CLONL_ClearScreen()
  298. say 'Wollen Sie ihren Puffer wirklich vollständig löschen?'
  299. say ''
  300. wahl=CLONL_ShortMenu('Ja, trotz eventuellem Mailverlust','Nein, auf gar keinen Fall!')
  301. if wahl~='J' then do
  302.     say ''
  303.     say 'Die Operation wurde abgebrochen!'
  304.     say ''
  305.     call CLONL_Wait()
  306.     end
  307. else do
  308.     address command 'delete >NIL: 'systempfad||point||suffix
  309.     say ''
  310.     say 'Der Puffer wurde gelöscht!'
  311.     say ''
  312.     call CLONL_Wait()
  313.     end
  314. call CLONL_ClearScreen()
  315. call menu1
  316. return
  317.  
  318. newpoint:
  319.  
  320. if exists('CONNECTLINE:online/'sprache'/Pointuser.antrag') then do
  321.     call CLONL_ClearScreen()
  322.     call CLONL_BlueMode()
  323.     say 'CL-Pointuser                                                                  '
  324.     call CLONL_Normal()
  325.     say ''
  326.     call CLONL_PrintFile('CONNECTLINE:online/'sprache'/Pointuser.antrag')
  327.     call CLONL_Wait()
  328.     end
  329.  
  330. call CLONL_ClearScreen()
  331. call CLONL_BlueMode()
  332. say 'CL-Pointuser                                                                  '
  333. call CLONL_Normal()
  334. say ''
  335.  
  336. ctr=0
  337. pointanz=0
  338. sysanz=CLGET_SystemNumberOf()
  339.  
  340. say 'Einen Moment, bitte ...'
  341. 'rx 'stdiomod' CURSOROFF'
  342. call writech(STDOUT,' ')
  343.  
  344. do g=1 to sysanz
  345.     system=CLGET_SystemName(g)
  346.     if CLGET_SystemPointuser(system)~='' then pointanz=pointanz+1
  347.     ctr=ctr+1
  348.     if ctr//5=0 then do
  349.         if terminal~='TTY' then do
  350.             select
  351.                 when ctr//4=1 then call writech(STDOUT,'-')
  352.                 when ctr//4=2 then call writech(STDOUT,'\')
  353.                 when ctr//4=3 then call writech(STDOUT,'|')
  354.                 otherwise call writech(STDOUT,'/')
  355.                 end
  356.             end
  357.         else call writech(STDOUT,'+')
  358.         end
  359.     end
  360.  
  361. if terminal='TTY' then say ''
  362.  
  363. call CLONL_GotoXY(1,3)
  364. call CLONL_DeleteEOL()
  365. call CLONL_GotoXY(1,4)
  366. call CLONL_DeleteEOL()
  367. 'rx 'stdiomod' CURSORON'
  368. pointeingabe:
  369. call CLONL_GotoXY(1,5)
  370. call CL_PutStr('Pointname        : '); point=CLONL_BlueRead(8,'P'||pointanz+1)
  371. if CLIS_SystemExists(point) then do
  372.     say 'Es gibt schon ein System mit diesem Namen!'
  373.     call CLONL_Wait()
  374.     call CLONL_GotoXY(1,6)
  375.     call CLONL_DeleteEOL()
  376.     call CLONL_GotoXY(1,7)
  377.     call CLONL_DeleteEOL()
  378.     call pointeingabe
  379.     end
  380. call CLONL_GotoXY(1,6)
  381. call CL_PutStr('Passwort         : '); pw=CLONL_BlueRead(8)
  382. call CLONL_GotoXY(1,9)
  383. taste=CLONL_ShortMenu('Point beantragen','Abbrechen      ')
  384. select
  385.     when taste='A' then do
  386.         point=''
  387.         pw=''
  388.         return
  389.         end
  390.     when taste='P' then nop
  391.     otherwise nop
  392.     end
  393.  
  394. say 'Der Point wird eingerichtet.'
  395.  
  396. system=CLGET_OwnSystemAddress()
  397. call CL_SystemNew(point)
  398. call CLSET_SystemPassword(point,pw)
  399. call CLSET_SystemDomain(point,system)
  400. call CLSET_SystemRoute(point,point)
  401. call CLSET_SystemNet(point,'JANUS')
  402. call CLSET_SystemProtocol(point,'ZMODEM')
  403. call CLSET_SystemPackerIn(point,'LHA')
  404. call CLSET_SystemPackerOut(point,'LHA')
  405. call CLSET_SystemPointuser(point,user)
  406. call CLSET_SystemPriority(point,'0')
  407. call CLSET_SystemMapsAccess(point,1)
  408. call CLSET_SystemAutoEntry(point,0)
  409. call CLSET_UserCopyTo(user,user||'@'||point)
  410. call CL_SystemSaveList()
  411.  
  412. say 'Ich schicke eine Testnachricht mit ihren Pointeinstellungen zu Ihnen.'
  413. if ~open('test','T:NewPoint.'user'.'port,'W') then say 'Testmail kann nicht erstellt werden !'
  414. else do
  415.     call writeln 'test','Pointname        : '||point
  416.     call writeln 'test','Pointpasswort    : '||pw
  417.     call writeln 'test','Ihr Username     : '||user
  418.     call writeln 'test','Ihre Domain      : .'||right(system,length(system)-pos('.',system))
  419.     call writeln 'test','Netzprotokoll    : JANUS'
  420.     call writeln 'test','Transferprotokoll: ZMODEM'
  421.     call writeln 'test','Packer           : LHA'
  422.     call writeln 'test',''
  423.     call close 'test'
  424.     call CLONL_Sendmail('Pointuser',user,'Ihre Pointeinstellungen','T:NewPoint.'user'.'port)
  425.     call CLONL_Sendmail('Pointuser','root','#Pointantrag','T:NewPoint.'user'.'port)
  426.     call delete('T:NewPoint.'user'.'port)
  427.     end
  428. say 'Fertig.'
  429. say 'Es wurden einige Defaulteinstellungen getroffen, eine Liste der Daten'
  430. say 'finden Sie in Kürze in ihrem Postfach. Wünschen sie hier noch Änderungen,'
  431. say 'setzten Sie sich bitte mit der Systembetreuung in Verbindung, damit die'
  432. say 'gewünschten Änderungen getroffen werden können.'
  433. say 'Des weiteren hat ihr Point bis durch Bestätigung durch die Systembetreu-'
  434. say 'ung nur limitierte Zugriffsrechte.'
  435. say ''
  436. call CLONL_Wait()
  437. call start
  438. exit
  439.  
  440.